sublime text Notes

Must Watch!



MustWatch

sublime text tutorial Emmet sublime plugin readme Emmet Cheat Sheet ES7 React Redux ReactNative JS snippets
Sublime Text Snippet language scopes
CSS: source.css
HTML: text.html(.basic)
JSON: source.json
Javascript: source.js
PHP: source.php
Regular Expression(python): source.regexp.python
Python: source.python
R: source.r
Regular Expression: source.regexp
SQL: source.sql
Plain text: text.plain
Sublime Text3开发PHP技巧

Selection by Mark

the “Mark” feature go to the last line you want to select Edit > Mark > Set Mark (ctrl + K, ctrl + space) go to the first line you want to select. Edit > Mark > Select to Mark (ctrl + K, ctrl + A)

current encoding

see the current encoding of a file in Sublime Text in user preferences, add the line: "show_encoding": true View -> Show Console type on the console the following command: view.encoding() sublime到底是以什么编码格式去理解文本呢? 这又是sublime的强大之处了。 sublime会先读取文本的前几个字符,然后猜测要解码的文本是用什么编码的,猜到什么,就用什么编码格式去理解文本,然后把它解码。 既然是猜,那就可能会猜错,这时候就要靠你自己去指定这个格式了,于是reopen with encoding就派上用场了,你用reopen with encoding,可以告诉sublime用什么编码去理解文本。 reopen with encoding是sublime自带的,不支持GBK等字符,reload with encoding是一个叫做ConvertToUTF8的插件提供的,专门用于支持GBK等字符,和reopen with encoding一样也是用来指定解码格式的。 它还提供一个与save with encoding相同功能的操作叫做set file encoding to,用一支持将“编码”目标编码格式指定为GBK等,但是它不立即保存文件到磁盘。 要注意的是,因为ConvertToUTF8是一个为了专门支持GBK等编码的插件,所以它的优先级是高于sublime本身的,当你用set file encoding to指定为GBK是,你在用save with encoding想把文件保存成utf-8,它会帮你保存为GBK(因为sublime本身不支持GBK,所以ConvertToUTF8为了支持GBK不得不这么做)。

Fold / Collapse the code section

go to edit->code folding and choose "fold all" or "unfold all" ctrl + shift + [ ctrl + shift + ]

lookbehind and lookahead

Question: What is: (?<=x) Positive lookbehind. sublime text Positive lookbehind ================================ Note: after bracket, some characters must follow to form a paired condition. Find all instances of p preceded by space (?<= )p Find all instances of double space not preceded by space (?<=[^\s]) Find all instances of double space preceded by : (?<=:) sublime text Positive lookahead ================================ Note: before bracket, some characters must precede to form a paired condition for look ahead. Find all spaces, followed by of (?=of) Find all ins, followed by tan ins(?=tan) Find all ins, NOT followed by tan, note! without the (=) sign ins(?!tan) Find all spaces, followed by a question mark, a period or an exclamation mark: (?=(\?|\.|!))

preferrence settings

{ "auto_complete": true, "auto_complete_commit_on_tab": false, "auto_indent": false, "bold_folder_labels": true, "caret_extra_width": 2, "caret_style": "phase", "color_scheme": "Packages/User/0Amytheme.tmTheme", "detect_indentation": false, "detect_slow_plugins": false, "fade_fold_buttons": false, "font_face": "微軟雅黑", "font_size": 21.0, "highlight_line": true, "ignored_packages": [ "Vintage" ], "line_numbers": false, "line_padding_bottom": 5, "line_padding_top": 5, "remember_full_screen": true, "rulers": [ 100 ], "tab_completion": false, "tab_size": 5, "theme": "Adaptive.sublime-theme", "translate_tabs_to_spaces": false, "update_check": false, "wide_caret": true, "word_separators": "./\\()\"'-:,;<>~!@#$%^&*|+=[]{}`~?“”_" }

to sort numerically

to sort numerically Get insertion points at the start of each line (Windows: Ctrl+A, Ctrl+Shift+L, Home), then insert at least as many spaces at the start of the lines as your widest number (here it’s 100, so at least 3 spaces). Now press End: Cursor back to the left past the digits: Selected the leading space and delete it (Ctrl+Shift+Left, Del). Because the insertion points were relative to the length of the numbers, all the numbers should now line up on the right now just do a normal Edit - Sort Lines

Sublime text Commands

♦Sublime text Commands


Preferences.sublime-settings

Note: for portable version, create a folder: Color Scheme - Default, and put the theme file 0Amytheme.tmTheme to be effective. { "auto_complete": false, "auto_complete_commit_on_tab": false, "caret_extra_width": 4, "caret_style": "phase", "color_scheme": "Packages/Color Scheme - Default/0Amytheme.tmTheme", "detect_indentation": false, "detect_slow_plugins": false, "font_face": "SimSun", "font_size": 22.0, "highlight_line": true, "ignored_packages": ["Vintage"], "line_padding_bottom": 1, "line_padding_top": 1, "rulers": [80], "tab_completion": false, "tab_size": 5, "translate_tabs_to_spaces": false, "wide_caret": true } [ {"args":{"characters": "<a href=\""},"command": "insert"}, {"args":{"extend": false,"to": "hardeol"},"command": "move_to"}, {"args":{"characters": "\">"},"command": "insert"}, {"args": null,"command": "right_delete"}, {"args":{"extend": false,"to": "hardeol"},"command": "move_to"}, {"args":{"characters": ""},"command": "insert"}, {"args":{"by": "characters","forward": true},"command": "move"}, {"args":{"characters": "
"},"command": "insert"} ]


RegReplace

Reference: creating command in sublime text regreplace, regreplace hints, RegReplace User Guide, RegReplace about

Settings file that stores settings specific to RegReplace

Preferences > Package Settings > Reg Replace > User edit any commands here: {"replacements":{ "break。": { "find": "。", "name": "break。", "replace": "。\n", "greedy": true}, "break?": { "find": "?", "name": "break?", "replace": "?\n", "greedy": true}, "break!": { "find": "!", "name": "break!", "replace": "!\n", "greedy": true}, "break:": { "find": ":", "name": "break:", "replace": ":\n", "greedy": true}, "break;": { "find": ";", "name": "break;", "replace": ";\n", "greedy": true} } } inside User package (use Preferences > Browse Packages) create a file named Default.sublime-commands and then add the commands: [ {"caption": "RegReplace: process ChinChar", "command": "reg_replace", "args": {"replacements": ["break。", "break?", "break!", "break:", "break;", "break. "], "find_only":false} } ] A sublime-commands file is a JSON file that expects an array of the commands to be added to the command palette Sample: Default.sublime-commands [ { "caption": "RegReplace: process ChinChar", "command": "reg_replace", "args": {"replacements": ["break。", "break?", "break!", "break:", "break;"], "find_only":false} } ] key bindings: {"keys": ["ctrl+shift+."], "command": "reg_replace", "args": {"replacements": ["break。", "break?", "break!", "break:", "break;"]} }, References: Command Palette Key Bindings Some break list and rejoin list =============================== 。?:…! 。” 。" !" ?" …。

RegReplace

Place the following text in Preferences -> PackageSettings -> RegReplace -> Rules-User, and save the file: {"replacements":{ "remove_a": { "find": "a", "name": "remove_a", "replace": "", "greedy": true} } } Then, execute the view.run_command('reg_replace',{"replacements": ["remove_a"]}) command from the Console.

Alternatively

create your new rule by doing the following: Open the Command Palette (Ctrl + Shift + P) Type: regrep Select the RegReplace: Create New Regular Expression Rule option In the "settings panel" that opens, configure the following settings (include the double-quotes): name = "remove_a" find = "a" replace = "" greedy = True With the cursor still in the "settings panel", press Ctrl+S to save the settings To close the "settings panel", press the Esc key Once a rule has been created via either of the above methods, it can be edited via the Command Palette's RegReplace: Edit Regular Expression Rule option, which will allow you to select one of the existing named rules to edit.

Reference:

The "A Better Way To Create Regex Rules" in User Guide

RegReplace User Guide

♦RegReplace User Guide


Snippets

♦Sublime Text Snippets


Emmet Notes

♦Emmet Notes
♦Mastering Emmet

programming sublime

Default.sublime-commands in C:\Users\User\AppData\Roaming\Sublime Text 3\Packages\User a file called Default.sublime-commands in your Packages/User folder sublimetext macros snippets sublimetext command_palette a find_all_under command

ahref tail.sublime-macro

[ {"args":{"characters": "<a href=\""},"command": "insert"}, {"args":{"extend": false,"to": "hardeol"},"command": "move_to"}, {"args":{"characters": "\">"},"command": "insert"}, {"args": null,"command": "right_delete"}, {"args":{"extend": false,"to": "hardeol"},"command": "move_to"}, {"args":{"characters": "</a>"},"command": "insert"}, {"args":{"by": "characters","forward": true},"command": "move"}, {"args":{"characters": "<br>"},"command": "insert" } ]

\Sublime Text\Data\Packages\User\Default (Windows).sublime-keymap

[ {"keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" }, {"keys": ["ctrl+shift+t"], "command": "toggle_tabs" }, {"keys": ["ctrl+k", "ctrl+k"], "command": "toggle_status_bar" }, {"keys": ["ctrl+alt+w"], "command": "toggle_setting","args": {"setting": "word_wrap"}}, {"keys": ["ctrl+shift+l"], "command": "toggle_setting", "args": { "setting": "line_numbers"} }, { "keys": ["ctrl+shift+j"], "command": "split_selection_into_lines" }, {"keys": ["ctrl+shift+r"], "command": "reopen_last_file" }, {"keys": ["ctrl+shift+c"], "command": "title_case" }, {"keys": ["f8"], "command": "permute_lines", "args": {"operation": "unique"} }, {"keys": ["ctrl+shift+d"], "command": "duplicate_lines" }, {"keys": ["f12"], "command": "reindent", "args": {"single_line": true}}, {"keys": ["shift+f2"], "command": "select_to_bookmark", "args": {"forward": true}}, { "keys": ["tab"], "command": "insert", "args": {"characters": "\t"}, "context": [{ "key": "auto_complete_visible" }]}, {"keys": ["ctrl+shift+m"], "command": "run_macro_file", "args": { "file": "Packages/User/ahref tail.sublime-macro" }}, {"keys": ["ctrl+shift+e"], "command": "run_macro_file", "args": { "file": "Packages/User/EOLmac.sublime-macro" }}, {"keys": ["ctrl+d"], "command": "run_macro_file", "args": { "file": "Packages/User/deleteImg.sublime-macro" }}, {"keys": ["ctrl+."], "command": "run_macro_file", "args": { "file": "Packages/User/insertline.sublime-macro" }}, {"keys": ["ctrl+alt+b"], "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu"}}, {"keys": ["ctrl+up"], "command": "scroll_lines", "args": {"amount": 1.0 } }, {"keys": ["ctrl+down"], "command": "scroll_lines", "args": {"amount": -1.0 } } ]

\Sublime Text\Data\Packages\Default\Default (Windows).sublime-keymap

[ { "keys": ["ctrl+shift+n"], "command": "new_window" }, { "keys": ["ctrl+o"], "command": "prompt_open_file" }, { "keys": ["ctrl+shift+t"], "command": "reopen_last_file" }, { "keys": ["alt+o"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} }, { "keys": ["ctrl+n"], "command": "new_file" }, { "keys": ["ctrl+s"], "command": "save" }, { "keys": ["ctrl+shift+s"], "command": "prompt_save_as" }, { "keys": ["ctrl+f4"], "command": "close_file" }, { "keys": ["ctrl+w"], "command": "close" }, { "keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" }, { "keys": ["f11"], "command": "toggle_full_screen" }, { "keys": ["shift+f11"], "command": "toggle_distraction_free" }, { "keys": ["backspace"], "command": "left_delete" }, { "keys": ["shift+backspace"], "command": "left_delete" }, { "keys": ["ctrl+shift+backspace"], "command": "left_delete" }, { "keys": ["delete"], "command": "right_delete" }, { "keys": ["enter"], "command": "insert", "args": {"characters": "\n"} }, { "keys": ["shift+enter"], "command": "insert", "args": {"characters": "\n"} }, { "keys": ["ctrl+z"], "command": "undo" }, { "keys": ["ctrl+shift+z"], "command": "redo" }, { "keys": ["ctrl+y"], "command": "redo_or_repeat" }, { "keys": ["ctrl+u"], "command": "soft_undo" }, { "keys": ["ctrl+shift+u"], "command": "soft_redo" }, { "keys": ["ctrl+shift+v"], "command": "paste_and_indent" }, { "keys": ["shift+delete"], "command": "cut" }, { "keys": ["ctrl+insert"], "command": "copy" }, { "keys": ["shift+insert"], "command": "paste" }, { "keys": ["ctrl+x"], "command": "cut" }, { "keys": ["ctrl+c"], "command": "copy" }, { "keys": ["ctrl+v"], "command": "paste" }, { "keys": ["left"], "command": "move", "args": {"by": "characters", "forward": false} }, { "keys": ["right"], "command": "move", "args": {"by": "characters", "forward": true} }, { "keys": ["up"], "command": "move", "args": {"by": "lines", "forward": false} }, { "keys": ["down"], "command": "move", "args": {"by": "lines", "forward": true} }, { "keys": ["shift+left"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true} }, { "keys": ["shift+right"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true} }, { "keys": ["shift+up"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true} }, { "keys": ["shift+down"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true} }, { "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} }, { "keys": ["ctrl+right"], "command": "move", "args": {"by": "word_ends", "forward": true} }, { "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} }, { "keys": ["ctrl+shift+right"], "command": "move", "args": {"by": "word_ends", "forward": true, "extend": true} }, { "keys": ["alt+left"], "command": "move", "args": {"by": "subwords", "forward": false} }, { "keys": ["alt+right"], "command": "move", "args": {"by": "subword_ends", "forward": true} }, { "keys": ["alt+shift+left"], "command": "move", "args": {"by": "subwords", "forward": false, "extend": true} }, { "keys": ["alt+shift+right"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true} }, { "keys": ["ctrl+alt+up"], "command": "select_lines", "args": {"forward": false} }, { "keys": ["ctrl+alt+down"], "command": "select_lines", "args": {"forward": true} }, { "keys": ["pageup"], "command": "move", "args": {"by": "pages", "forward": false} }, { "keys": ["pagedown"], "command": "move", "args": {"by": "pages", "forward": true} }, { "keys": ["shift+pageup"], "command": "move", "args": {"by": "pages", "forward": false, "extend": true} }, { "keys": ["shift+pagedown"], "command": "move", "args": {"by": "pages", "forward": true, "extend": true} }, { "keys": ["home"], "command": "move_to", "args": {"to": "bol", "extend": false} }, { "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} }, { "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true} }, { "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} }, { "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof", "extend": false} }, { "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof", "extend": false} }, { "keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true} }, { "keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} }, { "keys": ["ctrl+up"], "command": "scroll_lines", "args": {"amount": 1.0 } }, { "keys": ["ctrl+down"], "command": "scroll_lines", "args": {"amount": -1.0 } }, { "keys": ["ctrl+pagedown"], "command": "next_view" }, { "keys": ["ctrl+pageup"], "command": "prev_view" }, { "keys": ["ctrl+tab"], "command": "next_view_in_stack" }, { "keys": ["ctrl+shift+tab"], "command": "prev_view_in_stack" }, { "keys": ["ctrl+a"], "command": "select_all" }, { "keys": ["ctrl+shift+l"], "command": "split_selection_into_lines" }, { "keys": ["escape"], "command": "single_selection", "context": [{ "key": "num_selections", "operator": "not_equal", "operand": 1 }] }, { "keys": ["escape"], "command": "clear_fields", "context": [{ "key": "has_next_field", "operator": "equal", "operand": true }] }, { "keys": ["escape"], "command": "clear_fields", "context": [{ "key": "has_prev_field", "operator": "equal", "operand": true }] }, { "keys": ["escape"], "command": "hide_panel", "args": {"cancel": true},"context": [{ "key": "panel_visible", "operator": "equal", "operand": true }] }, { "keys": ["escape"], "command": "hide_overlay", "context": [{ "key": "overlay_visible", "operator": "equal", "operand": true }] }, { "keys": ["escape"], "command": "hide_auto_complete", "context": [{ "key": "auto_complete_visible", "operator": "equal", "operand": true }] }, { "keys": ["tab"], "command": "reindent", "context": [{ "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_match", "operand": "^$", "match_all": true }, { "key": "following_text", "operator": "regex_match", "operand": "^$", "match_all": true }] }, { "keys": ["tab"], "command": "indent", "context": [{ "key": "text", "operator": "regex_contains", "operand": "\n" }] }, { "keys": ["tab"], "command": "next_field", "context": [{ "key": "has_next_field", "operator": "equal", "operand": true }] }, { "keys": ["shift+tab"], "command": "insert", "args": {"characters": "\t"} }, { "keys": ["shift+tab"], "command": "unindent", "context": [{ "key": "setting.shift_tab_unindent", "operator": "equal", "operand": true }] }, { "keys": ["shift+tab"], "command": "unindent", "context": [{ "key": "preceding_text", "operator": "regex_match", "operand": "^[\t ]*" }] }, { "keys": ["shift+tab"], "command": "unindent", "context": [{ "key": "text", "operator": "regex_contains", "operand": "\n" }] }, { "keys": ["shift+tab"], "command": "prev_field", "context": [{ "key": "has_prev_field", "operator": "equal", "operand": true }] }, { "keys": ["ctrl+]"], "command": "indent" }, { "keys": ["ctrl+["], "command": "unindent" }, { "keys": ["insert"], "command": "toggle_overwrite" }, { "keys": ["ctrl+l"], "command": "expand_selection", "args": {"to": "line"} }, { "keys": ["ctrl+d"], "command": "find_under_expand" }, { "keys": ["ctrl+k", "ctrl+d"], "command": "find_under_expand_skip" }, { "keys": ["ctrl+shift+space"], "command": "expand_selection", "args": {"to": "scope"} }, { "keys": ["ctrl+shift+m"], "command": "expand_selection", "args": {"to": "brackets"} }, { "keys": ["ctrl+m"], "command": "move_to", "args": {"to": "brackets"} }, { "keys": ["ctrl+shift+j"], "command": "expand_selection", "args": {"to": "indentation"} }, { "keys": ["ctrl+shift+a"], "command": "expand_selection", "args": {"to": "tag"} }, { "keys": ["alt+."], "command": "close_tag" }, { "keys": ["ctrl+q"], "command": "toggle_record_macro" }, { "keys": ["ctrl+shift+q"], "command": "run_macro" }, { "keys": ["ctrl+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line.sublime-macro"} }, { "keys": ["ctrl+shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line Before.sublime-macro"} }, { "keys": ["enter"], "command": "commit_completion", "context": [{ "key": "auto_complete_visible" }, { "key": "setting.auto_complete_commit_on_tab", "operand": false }] }, { "keys": ["ctrl+p"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }, { "keys": ["ctrl+shift+p"], "command": "show_overlay", "args": {"overlay": "command_palette"} }, { "keys": ["ctrl+alt+p"], "command": "prompt_select_project" }, { "keys": ["ctrl+r"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} }, { "keys": ["ctrl+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, { "keys": ["ctrl+;"], "command": "show_overlay", "args": {"overlay": "goto", "text": "#"} }, { "keys": ["ctrl+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":false} }, { "keys": ["ctrl+shift+i"], "command": "show_panel", "args": {"panel": "incremental_find", "reverse":true} }, { "keys": ["ctrl+f"], "command": "show_panel", "args": {"panel": "find"} }, { "keys": ["ctrl+h"], "command": "show_panel", "args": {"panel": "replace"} }, { "keys": ["ctrl+shift+h"], "command": "replace_next" }, { "keys": ["f3"], "command": "find_next" }, { "keys": ["shift+f3"], "command": "find_prev" }, { "keys": ["ctrl+f3"], "command": "find_under" }, { "keys": ["ctrl+shift+f3"], "command": "find_under_prev" }, { "keys": ["alt+f3"], "command": "find_all_under" }, { "keys": ["ctrl+e"], "command": "slurp_find_string" }, { "keys": ["ctrl+shift+e"], "command": "slurp_replace_string" }, { "keys": ["ctrl+shift+f"], "command": "show_panel", "args": {"panel": "find_in_files"} }, { "keys": ["f4"], "command": "next_result" }, { "keys": ["shift+f4"], "command": "prev_result" }, { "keys": ["f6"], "command": "toggle_setting", "args": {"setting": "spell_check"} }, { "keys": ["ctrl+f6"], "command": "next_misspelling" }, { "keys": ["ctrl+shift+f6"], "command": "prev_misspelling" }, { "keys": ["ctrl+shift+up"], "command": "swap_line_up" }, { "keys": ["ctrl+shift+down"], "command": "swap_line_down" }, { "keys": ["ctrl+backspace"], "command": "delete_word", "args": { "forward": false } }, { "keys": ["ctrl+shift+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, { "keys": ["ctrl+delete"], "command": "delete_word", "args": { "forward": true } }, { "keys": ["ctrl+shift+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, { "keys": ["ctrl+/"], "command": "toggle_comment", "args": { "block": false } }, { "keys": ["ctrl+shift+/"], "command": "toggle_comment", "args": { "block": true } }, { "keys": ["ctrl+j"], "command": "join_lines" }, { "keys": ["ctrl+shift+d"], "command": "duplicate_line" }, { "keys": ["ctrl+`"], "command": "show_panel", "args": {"panel": "console", "toggle": true} }, { "keys": ["ctrl+space"], "command": "auto_complete" }, { "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context": [{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" }, { "key": "auto_complete_visible", "operator": "equal", "operand": false }, { "key": "setting.tab_completion", "operator": "equal", "operand": false }] }, { "keys": ["ctrl+alt+shift+p"], "command": "show_scope_name" }, { "keys": ["f7"], "command": "build" }, { "keys": ["ctrl+b"], "command": "build" }, { "keys": ["ctrl+shift+b"], "command": "build", "args": {"variant": "Run"} }, { "keys": ["ctrl+break"], "command": "exec", "args": {"kill": true} }, { "keys": ["ctrl+t"], "command": "transpose" }, { "keys": ["f9"], "command": "sort_lines", "args": {"case_sensitive": false} }, { "keys": ["ctrl+f9"], "command": "sort_lines", "args": {"case_sensitive": true} }, // Auto-pair quotes { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"$0\""}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[\"a-zA-Z0-9_]$", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.double", "match_all": true }] }, { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"${0:$SELECTION}\""}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }] }, { "keys": ["\""], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true }] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\"$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\"", "match_all": true }] }, // Auto-pair single quotes { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, { "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true }, { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true }] }, { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'${0:$SELECTION}'"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }] }, { "keys": ["'"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "'$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^'", "match_all": true }] }, // Auto-pair brackets { "keys": ["("], "command": "insert_snippet", "args": {"contents": "($0)"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true }] }, { "keys": ["("], "command": "insert_snippet", "args": {"contents": "(${0:$SELECTION})"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }] }, { "keys": [")"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\($", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\)", "match_all": true }] }, // Auto-pair square brackets { "keys": ["["], "command": "insert_snippet", "args": {"contents": "[$0]"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|;|\\}|$)", "match_all": true }] }, { "keys": ["["], "command": "insert_snippet", "args": {"contents": "[${0:$SELECTION}]"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }] }, { "keys": ["]"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true }] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\[$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\]", "match_all": true }] }, // Auto-pair curly brackets { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{$0}"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true }] }, { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{${0:$SELECTION}}"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true }] }, { "keys": ["}"], "command": "move", "args": {"by": "characters", "forward": true}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }] }, { "keys": ["backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Left Right.sublime-macro"}, "context": [{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }] }, { "keys": ["enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": [{ "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }] }, { "keys": ["shift+enter"], "command": "run_macro_file", "args": {"file": "Packages/Default/Add Line in Braces.sublime-macro"}, "context": [{ "key": "setting.auto_indent", "operator": "equal", "operand": true }, { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, { "key": "preceding_text", "operator": "regex_contains", "operand": "\\{$", "match_all": true }, { "key": "following_text", "operator": "regex_contains", "operand": "^\\}", "match_all": true }] }, { "keys": ["alt+shift+1"], "command": "set_layout", "args": { "cols": [0.0, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1]] } }, { "keys": ["alt+shift+2"], "command": "set_layout", "args": { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] } }, { "keys": ["alt+shift+3"], "command": "set_layout", "args": { "cols": [0.0, 0.33, 0.66, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1]] } }, { "keys": ["alt+shift+4"], "command": "set_layout", "args": { "cols": [0.0, 0.25, 0.5, 0.75, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 1], [3, 0, 4, 1]] } }, { "keys": ["alt+shift+8"], "command": "set_layout", "args": { "cols": [0.0, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [[0, 0, 1, 1], [0, 1, 1, 2]] } }, { "keys": ["alt+shift+9"], "command": "set_layout", "args": { "cols": [0.0, 1.0], "rows": [0.0, 0.33, 0.66, 1.0], "cells": [[0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] } }, { "keys": ["alt+shift+5"], "command": "set_layout", "args": { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [ [0, 0, 1, 1], [1, 0, 2, 1], [0, 1, 1, 2], [1, 1, 2, 2] ] } }, { "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } }, { "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } }, { "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } }, { "keys": ["ctrl+4"], "command": "focus_group", "args": { "group": 3 } }, { "keys": ["ctrl+shift+1"], "command": "move_to_group", "args": { "group": 0 } }, { "keys": ["ctrl+shift+2"], "command": "move_to_group", "args": { "group": 1 } }, { "keys": ["ctrl+shift+3"], "command": "move_to_group", "args": { "group": 2 } }, { "keys": ["ctrl+shift+4"], "command": "move_to_group", "args": { "group": 3 } }, { "keys": ["ctrl+0"], "command": "focus_side_bar" }, { "keys": ["alt+1"], "command": "select_by_index", "args": { "index": 0 } }, { "keys": ["alt+2"], "command": "select_by_index", "args": { "index": 1 } }, { "keys": ["alt+3"], "command": "select_by_index", "args": { "index": 2 } }, { "keys": ["alt+4"], "command": "select_by_index", "args": { "index": 3 } }, { "keys": ["alt+5"], "command": "select_by_index", "args": { "index": 4 } }, { "keys": ["alt+6"], "command": "select_by_index", "args": { "index": 5 } }, { "keys": ["alt+7"], "command": "select_by_index", "args": { "index": 6 } }, { "keys": ["alt+8"], "command": "select_by_index", "args": { "index": 7 } }, { "keys": ["alt+9"], "command": "select_by_index", "args": { "index": 8 } }, { "keys": ["alt+0"], "command": "select_by_index", "args": { "index": 9 } }, { "keys": ["f2"], "command": "next_bookmark" }, { "keys": ["shift+f2"], "command": "prev_bookmark" }, { "keys": ["ctrl+f2"], "command": "toggle_bookmark" }, { "keys": ["ctrl+shift+f2"], "command": "clear_bookmarks" }, { "keys": ["alt+f2"], "command": "select_all_bookmarks" }, { "keys": ["ctrl+shift+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }, { "keys": ["alt+q"], "command": "wrap_lines" }, { "keys": ["ctrl+k", "ctrl+u"], "command": "upper_case" }, { "keys": ["ctrl+k", "ctrl+l"], "command": "lower_case" }, { "keys": ["ctrl+k", "ctrl+space"], "command": "set_mark" }, { "keys": ["ctrl+k", "ctrl+a"], "command": "select_to_mark" }, { "keys": ["ctrl+k", "ctrl+w"], "command": "delete_to_mark" }, { "keys": ["ctrl+k", "ctrl+x"], "command": "swap_with_mark" }, { "keys": ["ctrl+k", "ctrl+y"], "command": "yank" }, { "keys": ["ctrl+k", "ctrl+k"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }, { "keys": ["ctrl+k", "ctrl+backspace"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard BOL.sublime-macro"} }, { "keys": ["ctrl+k", "ctrl+g"], "command": "clear_bookmarks", "args": {"name": "mark"} }, { "keys": ["ctrl+k", "ctrl+c"], "command": "show_at_center" }, { "keys": ["ctrl++"], "command": "increase_font_size" }, { "keys": ["ctrl+="], "command": "increase_font_size" }, { "keys": ["ctrl+keypad_plus"], "command": "increase_font_size" }, { "keys": ["ctrl+-"], "command": "decrease_font_size" }, { "keys": ["ctrl+keypad_minus"], "command": "decrease_font_size" }, { "keys": ["alt+shift+w"], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" } }, { "keys": ["ctrl+shift+["], "command": "fold" }, { "keys": ["ctrl+shift+]"], "command": "unfold" }, { "keys": ["ctrl+k", "ctrl+1"], "command": "fold_by_level", "args": {"level": 1} }, { "keys": ["ctrl+k", "ctrl+2"], "command": "fold_by_level", "args": {"level": 2} }, { "keys": ["ctrl+k", "ctrl+3"], "command": "fold_by_level", "args": {"level": 3} }, { "keys": ["ctrl+k", "ctrl+4"], "command": "fold_by_level", "args": {"level": 4} }, { "keys": ["ctrl+k", "ctrl+5"], "command": "fold_by_level", "args": {"level": 5} }, { "keys": ["ctrl+k", "ctrl+6"], "command": "fold_by_level", "args": {"level": 6} }, { "keys": ["ctrl+k", "ctrl+7"], "command": "fold_by_level", "args": {"level": 7} }, { "keys": ["ctrl+k", "ctrl+8"], "command": "fold_by_level", "args": {"level": 8} }, { "keys": ["ctrl+k", "ctrl+9"], "command": "fold_by_level", "args": {"level": 9} }, { "keys": ["ctrl+k", "ctrl+0"], "command": "unfold_all" }, { "keys": ["ctrl+k", "ctrl+j"], "command": "unfold_all" }, { "keys": ["ctrl+k", "ctrl+t"], "command": "fold_tag_attributes" }, { "keys": ["context_menu"], "command": "context_menu" }, { "keys": ["alt+c"], "command": "toggle_case_sensitive", "context": [{ "key": "setting.is_widget", "operator": "equal", "operand": true }] }, { "keys": ["alt+r"], "command": "toggle_regex", "context": [{ "key": "setting.is_widget", "operator": "equal", "operand": true }] }, { "keys": ["alt+w"], "command": "toggle_whole_word", "context": [{ "key": "setting.is_widget", "operator": "equal", "operand": true }] }, { "keys": ["alt+a"], "command": "toggle_preserve_case", "context": [{ "key": "setting.is_widget", "operator": "equal", "operand": true }] }, // Find panel key bindings { "keys": ["enter"], "command": "find_next", "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] }, { "keys": ["shift+enter"], "command": "find_prev", "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] }, { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "find"}, {"key": "panel_has_focus"}] }, // Replace panel key bindings { "keys": ["enter"], "command": "find_next", "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, { "keys": ["shift+enter"], "command": "find_prev", "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, { "keys": ["ctrl+alt+enter"], "command": "replace_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "replace"}, {"key": "panel_has_focus"}] }, // Incremental find panel key bindings { "keys": ["enter"], "command": "hide_panel", "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] }, { "keys": ["shift+enter"], "command": "find_prev", "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] }, { "keys": ["alt+enter"], "command": "find_all", "args": {"close_panel": true}, "context": [{"key": "panel", "operand": "incremental_find"}, {"key": "panel_has_focus"}] } ]

\Sublime Text\Data\Packages\User\Preferences.sublime-settings

eg.: "font_face": "標楷體", { "auto_complete": false, "auto_complete_commit_on_tab": false, "caret_extra_width": 4, "caret_style": "phase", "color_scheme": "Packages/Color Scheme - Default/0Amytheme.tmTheme", "detect_indentation": false, "detect_slow_plugins": false, "font_face": "SimSun", "font_size": 22.0, "highlight_line": true, "ignored_packages": [ "Vintage" ], "line_padding_bottom": 1, "line_padding_top": 1, "rulers": [ 80 ], "tab_completion": false, "tab_size": 5, "translate_tabs_to_spaces": false, "wide_caret": true }

\Sublime Text\Data\Packages\User\0Amytheme.tmTheme

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>name</key> <string>Monokai</string> <key>settings</key> <array> <dict> <key>settings</key> <dict> <key>background</key> <string>#000000</string> <key>caret</key> <string>#FF0000</string> <key>foreground</key> <string>#CCCCCC</string> <key>invisibles</key> <string>#3B3A32</string> <key>lineHighlight</key> <string>#102808</string> <key>selection</key> <string>#001808</string> <key>findHighlight</key> <string>#803010</string> <key>findHighlightForeground</key> <string>#FFA0F0</string> <key>selectionBorder</key> <string>#FF0000</string> <key>activeGuide</key> <string>#9D550FB0</string> <key>bracketsForeground</key> <string>#A8C8A2C5</string> <key>bracketsOptions</key> <string>underline</string> <key>bracketContentsForeground</key> <string>#4FAF88A5</string> <key>bracketContentsOptions</key> <string>underline</string> <key>tagsOptions</key> <string>stippled_underline</string> </dict> </dict> <dict> <key>name</key> <string>Comment</string> <key>scope</key> <string>comment</string> <key>settings</key> <dict> <key>foreground</key> <string>#75715E</string> </dict> </dict> <dict> <key>name</key> <string>String</string> <key>scope</key> <string>string</string> <key>settings</key> <dict> <key>foreground</key> <string>#E6DB74</string> </dict> </dict> <dict> <key>name</key> <string>Number</string> <key>scope</key> <string>constant.numeric</string> <key>settings</key> <dict> <key>foreground</key> <string>#AE81FF</string> </dict> </dict> <dict> <key>name</key> <string>Built-in constant</string> <key>scope</key> <string>constant.language</string> <key>settings</key> <dict> <key>foreground</key> <string>#AE81FF</string> </dict> </dict> <dict> <key>name</key> <string>User-defined constant</string> <key>scope</key> <string>constant.character, constant.other</string> <key>settings</key> <dict> <key>foreground</key> <string>#AE81FF</string> </dict> </dict> <dict> <key>name</key> <string>Variable</string> <key>scope</key> <string>variable</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> </dict> </dict> <dict> <key>name</key> <string>Keyword</string> <key>scope</key> <string>keyword</string> <key>settings</key> <dict> <key>foreground</key> <string>#F92672</string> </dict> </dict> <dict> <key>name</key> <string>Storage</string> <key>scope</key> <string>storage</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#F92672</string> </dict> </dict> <dict> <key>name</key> <string>Storage type</string> <key>scope</key> <string>storage.type</string> <key>settings</key> <dict> <key>fontStyle</key> <string>italic</string> <key>foreground</key> <string>#66D9EF</string> </dict> </dict> <dict> <key>name</key> <string>Class name</string> <key>scope</key> <string>entity.name.class</string> <key>settings</key> <dict> <key>fontStyle</key> <string>underline</string> <key>foreground</key> <string>#A6E22E</string> </dict> </dict> <dict> <key>name</key> <string>Inherited class</string> <key>scope</key> <string>entity.other.inherited-class</string> <key>settings</key> <dict> <key>fontStyle</key> <string>italic underline</string> <key>foreground</key> <string>#A6E22E</string> </dict> </dict> <dict> <key>name</key> <string>Function name</string> <key>scope</key> <string>entity.name.function</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#A6E22E</string> </dict> </dict> <dict> <key>name</key> <string>Function argument</string> <key>scope</key> <string>variable.parameter</string> <key>settings</key> <dict> <key>fontStyle</key> <string>italic</string> <key>foreground</key> <string>#FD971F</string> </dict> </dict> <dict> <key>name</key> <string>Tag name</string> <key>scope</key> <string>entity.name.tag</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#F92672</string> </dict> </dict> <dict> <key>name</key> <string>Tag attribute</string> <key>scope</key> <string>entity.other.attribute-name</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#A6E22E</string> </dict> </dict> <dict> <key>name</key> <string>Library function</string> <key>scope</key> <string>support.function</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#66D9EF</string> </dict> </dict> <dict> <key>name</key> <string>Library constant</string> <key>scope</key> <string>support.constant</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#66D9EF</string> </dict> </dict> <dict> <key>name</key> <string>Library class/type</string> <key>scope</key> <string>support.type, support.class</string> <key>settings</key> <dict> <key>fontStyle</key> <string>italic</string> <key>foreground</key> <string>#66D9EF</string> </dict> </dict> <dict> <key>name</key> <string>Library variable</string> <key>scope</key> <string>support.other.variable</string> <key>settings</key> <dict> <key>fontStyle</key> <string></string> </dict> </dict> <dict> <key>name</key> <string>Invalid</string> <key>scope</key> <string>invalid</string> <key>settings</key> <dict> <key>background</key> <string>#F92672</string> <key>fontStyle</key> <string></string> <key>foreground</key> <string>#F8F8F0</string> </dict> </dict> <dict> <key>name</key> <string>Invalid deprecated</string> <key>scope</key> <string>invalid.deprecated</string> <key>settings</key> <dict> <key>background</key> <string>#AE81FF</string> <key>foreground</key> <string>#F8F8F0</string> </dict> </dict> <dict> <key>name</key> <string>JSON String</string> <key>scope</key> <string>meta.structure.dictionary.json string.quoted.double.json</string> <key>settings</key> <dict> <key>foreground</key> <string>#CFCFC2</string> </dict> </dict> <dict> <key>name</key> <string>diff.header</string> <key>scope</key> <string>meta.diff, meta.diff.header</string> <key>settings</key> <dict> <key>foreground</key> <string>#75715E</string> </dict> </dict> <dict> <key>name</key> <string>diff.deleted</string> <key>scope</key> <string>markup.deleted</string> <key>settings</key> <dict> <key>foreground</key> <string>#F92672</string> </dict> </dict> <dict> <key>name</key> <string>diff.inserted</string> <key>scope</key> <string>markup.inserted</string> <key>settings</key> <dict> <key>foreground</key> <string>#A6E22E</string> </dict> </dict> <dict> <key>name</key> <string>diff.changed</string> <key>scope</key> <string>markup.changed</string> <key>settings</key> <dict> <key>foreground</key> <string>#E6DB74</string> </dict> </dict> <dict> <key>scope</key> <string>constant.numeric.line-number.find-in-files - match</string> <key>settings</key> <dict> <key>foreground</key> <string>#AE81FFA0</string> </dict> </dict> <dict> <key>scope</key> <string>entity.name.filename.find-in-files</string> <key>settings</key> <dict> <key>foreground</key> <string>#E6DB74</string> </dict> </dict> </array> <key>uuid</key> <string>D8D5E82E-3D5B-46B5-B38E-8C841C21347D</string> </dict> </plist>

Build 3413 Enter License:

----- BEGIN LICENSE ----- Member J2TeaM Single User License EA7E-1011316 D7DA350E 1B8B0760 972F8B60 F3E64036 B9B4E234 F356F38F 0AD1E3B7 0E9C5FAD FA0A2ABE 25F65BD8 D51458E5 3923CE80 87428428 79079A01 AA69F319 A1AF29A4 A684C2DC 0B1583D4 19CBD290 217618CD 5653E0A0 BACE3948 BB2EE45E 422D2C87 DD9AF44B 99C49590 D2DBDEE1 75860FD2 8C8BB2AD B2ECE5A4 EFC08AF2 25A9B864 ------ END LICENSE ------ TwitterInc 200 User License EA7E-890007 1D77F72E 390CDD93 4DCBA022 FAF60790 61AA12C0 A37081C5 D0316412 4584D136 94D7F7D4 95BC8C1C 527DA828 560BB037 D1EDDD8C AE7B379F 50C9D69D B35179EF 2FE898C4 8E4277A8 555CE714 E1FB0E43 D5D52613 C3D12E98 BC49967F 7652EED2 9D2D2E61 67610860 6D338B72 5CF95C69 E36B85CC 84991F19 7575D828 470A92AB

How to disable Sublime Text’s update check (new version prompt):

Go to “Preferences -> Settings-User/Distraction Free“ Add this line: "update_check": false, Done! If this does not work, add the following lines to your hosts file: 127.0.0.1 www.sublimetext.com 127.0.0.1 license.sublimehq.com Windows C:\Windows\System32\drivers\etc\hosts Linux /etc/hosts https://teamtreehouse.com/community/unable-to-save-cwindowssystem32driversetchosts unable to save C:/Windows/system32/drivers/etc/hosts Edit file hosts windows path Lokasi hosts: C:\Windows\System32\drivers\etc Tambahkan: Sublime Text 3 0.0.0.0 license.sublimehq.com 0.0.0.0 45.55.255.55 0.0.0.0 45.55.41.223 License —– BEGIN LICENSE —– TwitterInc 200 User License EA7E-890007 1D77F72E 390CDD93 4DCBA022 FAF60790 61AA12C0 A37081C5 D0316412 4584D136 94D7F7D4 95BC8C1C 527DA828 560BB037 D1EDDD8C AE7B379F 50C9D69D B35179EF 2FE898C4 8E4277A8 555CE714 E1FB0E43 D5D52613 C3D12E98 BC49967F 7652EED2 9D2D2E61 67610860 6D338B72 5CF95C69 E36B85CC 84991F19 7575D828 470A92AB —— END LICENSE ——

The following is the User Settings:

{ "auto_complete": false, "auto_complete_commit_on_tab": false, "auto_indent": false, "caret_extra_width": 1, "caret_style": "phase", "color_scheme": "Packages/User/0Amytheme.tmTheme", "default_line_ending": "unix", "detect_indentation": true, "detect_slow_plugins": false, "font_face": "Microsoft JhengHei UI", "font_size": 21.0, "highlight_line": true, "ignored_packages": [ "Vintage" ], "line_numbers": false, "line_padding_bottom": 1, "line_padding_top": 1, "rulers": [ 80 ], "save_on_focus_lost": true, "tab_completion": false, "tab_size": 4, "translate_tabs_to_spaces": false, "update_check": false, "wide_caret": true, "word_separators": "./\\()\"'-:,.;<>!@#$%^&*|+=[]{}`~?“”_" } This is the User Key Bindings: [ {"keys": ["ctrl+alt+."], "command": "toggle_setting","args": {"setting": "line_numbers"}}, {"keys": ["ctrl+alt+w"], "command": "toggle_setting","args": {"setting": "word_wrap"}}, {"keys": ["ctrl+shift+r"], "command": "reopen_last_file" }, {"keys": ["ctrl+shift+c"], "command": "title_case" }, {"keys": ["ctrl+up"], "command": "scroll_lines", "args": {"amount": 1.0 } }, {"keys": ["f8"], "command": "permute_lines", "args": {"operation": "unique"} }, {"keys": ["ctrl+shift+d"], "command": "duplicate_lines" }, {"keys": ["ctrl+shift+m"], "command": "run_macro_file", "args": { "file": "Packages/User/ahref tail.sublime-macro" }}, {"keys": ["f12"], "command": "reindent", "args": {"single_line": true}}, {"keys": ["ctrl+alt+b"], "command": "run_existing_window_command", "args": { "id": "repl_python_run", "file": "config/Python/Main.sublime-menu"}}, {"keys": ["ctrl+down"], "command": "scroll_lines", "args": {"amount": -1.0 } } ]

Sublime Keyboard Shortcuts

Editing Ctrl + ↩ Insert line after Ctrl + ⇧ + ↩ Insert line before Ctrl + ⇧ + ↑ Move line/selection up Ctrl + ⇧ + ↓ Move line/selection down Ctrl + L Select line - Repeat to select next lines Ctrl + D Select word - Repeat select others occurrences Ctrl + M Jump to closing parentheses Repeat to jump to opening parentheses Ctrl + ⇧ + M Select all contents of the current parentheses Ctrl + ⇧ + K Delete Line Ctrl + KK Delete from cursor to end of line Ctrl + K + ⌫ Delete from cursor to start of line Ctrl + ] Indent current line(s) Ctrl + [ Un-indent current line(s) Ctrl + ⇧ + D Duplicate line(s) Ctrl + J Join line below to the end of the current line Ctrl + / Comment/un-comment current line The shortcut to comment out or uncomment the selected text or current line: Windows: Ctrl + / Ctrl + ⇧ + / Block comment current selection Ctrl + Y Redo, or repeat last keyboard shortcut command Ctrl + ⇧ + V Paste and indent correctly Ctrl + Space Select next auto-complete suggestion Ctrl + U soft undo; jumps to your last change before undoing change when repeated Alt + . Close current html tag Windows Ctrl + Alt + Up Column selection up Ctrl + Alt + Down Column selection down Navigation/Goto Anywhere Ctrl + R Goto symbol, Jump to a function, method, selector, header, or ID Ctrl + G To jump to a specific line Ctrl + P Press # Jump to a word, Goto word in current file Ctrl + P Press @ Jump to a function Ctrl + F3 jump to later instances General Ctrl + ⇧ + P Command prompt Ctrl + KB Toggle side bar Ctrl + ⇧ + Alt + P Show scope in status bar Find/Replace Ctrl + H Replace Ctrl + ⇧ + F Find in files Tabs Ctrl + ⇧ + t Open last closed tab Ctrl + PgUp Cycle up through tabs Ctrl + PgDn Cycle down through tabs Ctrl + ⇆ Find in files Alt + [NUM] Switch to tab number [NUM] where [NUM] <= number of tabs Split Panel Alt + ⇧ + 2 Split view into two columns Alt + ⇧ + 5 Set view to grid (4 panels) Alt + ⇧ + 8 Split view into two rows Ctrl + [NUM] Jump to numbered panel Ctrl + ⇧ + [NUM] Move file to specified panel where num is 1-4 Bookmarks Ctrl + F2 Toggle bookmark F2 Next bookmark ⇧ + F2 Previous bookmark Ctrl + ⇧ + F2 Clear bookmarks Text manipulation Ctrl + KU Transform to Uppercase Ctrl + KL Transform to Lowercase

Ctrl + Arrow behavior

http://compscientist.com/post/28272180856/word-separators "word delimiters" configuration Preference -> Settings - Default “word_separators”: “./\()"’-:,.;<>~!@#$%^&*|+=[]{}`~?”, { "keys": "ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} }, { "keys": "ctrl+right"], "command": "move", "args": {"by": "words", "forward": true} }, { "keys": "ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} }, { "keys": "ctrl+shift+right"], "command": "move", "args": {"by": "words", "forward": true, "extend": true} } changed ctrl+left and ctrl+shift+left from by word_ends to by words.

exclude a charachter in sublime text regex match and replace

Try this one: ([^;]+) [^;] means anything but semicolon :-) search last occurence abc(?!.*abc)

save with backup

"save_on_focus_lost": true,

hide tab

{ "keys": ["ctrl+shift+t"], "command": "toggle_tabs" }

让Sublime Text 2支持GB2312和GBK编码

第一步,确保已经安装了“Package Control”,有的话就跳过第一步 Sublime Text 2 安装 Sublime Package Control,通过 Sublime Package Control,安装、升级和卸载 Package。 安装 Package Control 的方法: 1、打开 Sublime Text 2,按下 Control + ` 调出 Console,通常这个快捷键会与PC上的其它软件起冲突,需要修改其它软件的这个快捷键。 2、将以下代码粘贴进命令行中并回车: import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()) 3、重启 Sublime Text 2,如果在 Preferences -> Package Settings中见到Package Control这一项,就说明安装成功了。 第二步:安装GBK包,这一步很简单 安装好Package Control之后,通过快捷键[ctrl+shift+p]调出command palette,然后输入install,调出Package Control,然后找到GBK,回车即可。

Regex: Find out all files that do not contain some words

This is a better solution: (?s)\A(?!.*(YOUR_WORDS).*$) ^<a href="((?!(http|LibDocs)).).*html"> <a ((?!_blank).)*"> Match string not containing tab ^((?!\t).)*$

Regular expression to stop at first match

Adding a ? on a quantifier (?, * or +) makes it non-greedy (.*?)

word_separators

The sublime text word_separator is: "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~?",

Sublime Text 支持GB2312和GBK编码 安装ConvertToUTF8

open the Sublime console Ctrl+` or View > Show Console enter the following command: sublime.log_commands(True) Now whenever you do anything, Sublime logs the command along with any arguments that it might take. list_all_commands list all of the available commands of all types into a new scratch buffer.

Project Format

Project Format { "folders": [ { "path": "/D/sublime" }, { "path": "/D/KPC" }, { "path": "/D/Users/SCL1122/Desktop" } ] }

Compare Side-By-Side

Right click on a tab and select “Compare with…”

package control common packages

ctrl+shift+p install package emmet help to type html codeintel intelligence and smart autocomplete engine, ie, ide material theme display theme, activation required after installation, by install package material theme activate sidebar enhancement advanced newfile gitgutter help to show difference versons docblockr helps to write comments sublimelinter jslint r-ide javascriptconsole

insert Cursor At End Of EachLine Selected

remove {"keys": ["ctrl+shift+l"], "command": "toggle_setting", "args": { "setting": "line_numbers"} }, add { "key": "ctrl+shift+l", "command": "editor.action.insertCursorAtEndOfEachLineSelected", "when": "editorTextFocus "}

Installing multiple packages in sublime text

Just use Preferences > Package Control > Package Control: Advanced Install Package. Then you can enter a comma-separated package list, e.g. ConvertToUTF8,MarkdownEditing,SublimeLinter,SublimeREPL.

Manual installation package control

https://packagecontrol.io/installation Click the Preferences > Browse Packages… menu Browse up a folder and then into the Installed Packages/ folder Download Package Control.sublime-package and copy it into the Installed Packages/ directory Restart Sublime Text

tabs and spaces for indentation

click Sublime Text 3 controls tabs and spaces for indentation

Regular expressions and Sublime Text

Since I have several regular expressions that I use over and over (and over) again, I decided to store them in TextExpander for quick reference. I prefix each snippet with rx, which lets me use the TextExpander global shortcut to bring up a TextExpander search box anywhere in macOS so I can just grab the one I need.

Using regular expressions to find text in Sublime Text is easy, but remember to press the .* button on the far left of the find/replace form first.

Regular expressions are even more powerful when you learn the “replace” syntax in Sublime Text. In the screenshot above, the regular expression ^.*\{frame\} is designed to find lines containing the LaTeX Beamer frame environment and match all text from the beginning of the line through the closing } to the right of frame.

By enclosing this search term in parentheses, I’m telling Sublime Text that I want to use it as a variable in my replace term. The variable is called $1. (You can separate multiple search terms with commas, to get $1, $2, etc.)

Therefore my replace term % $1 will effectively insert the % (LaTeX comment symbol) at the beginning of each matched line. This comments out all lines containing the frame environment so that LaTeX will ignore them—something that’s very useful in one of my LaTeX workflows.

But anyway, if you use Sublime Text a lot and want to take your find/replace routine to the next level, regular expressions are your friend.

RegExRX is a really handy Mac app for building and testing regular expressions.




folder exclude patterns

sublime-project: folder_exclude_patterns folder_exclude_patterns

Emmet 基本用法

Using Emmet with Sublime Text 產生一個 h1 元素 直接輸入 h1 後,按下 Tab 鍵或是 Ctrl+E 產生一個標準的 HTML5 樣板的話,我們可以直接輸入 ! 或是 html:5 .className: 產生元素時直接加上指定的 .className,例如:h1.title 要加上多個 .className 的話,只要把它們接在一起就可以了 一般預設的元素是 div,所以如果直接寫 .className 的話,就會自動產生一個 div 元素然後加上指定的 .className #id: 加上指定的 #id 同時加上 #id 及 .className 接在一起寫就可以了 更多關於元素的快捷縮寫方式都可以在官方的文件中找到:Emmet Cheat Sheet

gutter background

gutter #2e2e1f gutterForeground #6b6b47 lineHighlight #0f0f0a

SublimeREPL

SublimeREPL allows you to run the interpreter in multiple tabs. The tab is still editable like a normal sublime tab To install it press ctrl + shift + P Type in 'install', click on 'sublime package control: install package'. Then select SublimeREPL. Create Build System : In Top Bar > "Tools" > "Build System" > "New Build System" Replace all contents of the file with : { "target": "run_existing_window_command", "id": "repl_python_run", "file": "config/Python/Main.sublime-menu" } Save the file as "PythonRepl.sublime-build" in the default "user" folder. Using : 4.1) Open the Python file that you want to run in Sublime Text. 4.2) In Top Bar > "Tools" > "Build System" > "PythonRepl". 4.3) Build the Python file, by choosing In Top Bar > "Tools" > "Build" or Using either the build shortcut Ctrl+B

Javascript Console

Javascript Console In Sublime Text { "cmd": ["C:/Program Files/nodejs/node.exe", "$file"], "selector": "source.js" } JavaScript plugin for Sublime Text 3

edit Sublime Text build settings

edit Sublime Text build settings


Hide files with certain extension

Activate the default preferences tab (user preferences) and search for file_exclude_patterns folder_exclude_patterns "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"], "file_exclude_patterns": ["*.exe", "*.dll", "*.obj", "*.lib", "*.class", "*.psd", "*.db", "*.sublime-workspace"],

to check commands in Console

show command name binded to a certain key sublime.log_commands(True)

RegReplace manual installation

RegReplace manual installation


Install package manually

Install package manually put it in your User folder. if it's in the packages directory, then it is "installed". Sublime just scans the Packages directory and loads anything it finds at directory depth level 1 (so not recursively). or using "Package Control: Add repository."

show sublime.log_commands

sublime.log_commands(True)

Sublime Text Python IDE

Sublime Text Python IDE

JavaScript console in Sublime Text

Google Chrome Javascript Console isn't the most comfortable tool for sure. Tools like jsbin.com or jsfiddle.net are super cool but lets confirm that, nothing is more convenient to write a piece of code than your favourite editor.

Build systems allows you to run your files through external programs without manually switching between code editor and Terminal. Sublime Text comes with few predefined profiles.

Our mission is to add a new one for JavaScript. We are going to use node.js. Make sure it is already installed on your device.

Create JavaScript build system in Sublime Text

Every built system is described on JSON file with .sublime-build extension. To create new one go to Tools > Build System > New Build System… If you are mac OS user, copy and paste this bit of code:

{ "cmd": ["/usr/local/bin/node", "$file"], "selector": "source.js" }

Windows users…

{ "cmd": ["C:/Program Files/nodejs/node.exe", "$file"], "selector": "source.js" }

In most cases single node command does the job instead of passing a full path to node. I found this method more reliable though. If you are not sure where node is installed, just type which node in Terminal (mac OS) or where node in command prompt (windows users) to get the path.

Save this file as a JavaScript.sublime-build in “User” directory inside Sublime Text settings folder.

Time for fun part. Create and save a JavaScript file (to execute a node interpreter, file needs to be saved), code some super amazing script and click Cmd + B (mac OS) or F7 (Windows). You can run this task manually from Tools > Build. Sublime Text should automatically run your script through appropriate build system. If something doesn't work correctly go to Tools > Build System and make sure that Automatically or JavaScript is selected. Enjoy!

word_separators for R language

Sublime Text R Resources Add . as a word character for your R files/projects. With an R file open, go to Preferences > Settings - More > Syntax Specific - User. This will create an empty R.sublime-settings file in your Packages/User folder. Add the word_separators variable, like so: {"word_separators": "/\\()\"'-:,;<>~!@#$%^&*|+=[]{}`~?"} Save the file, and your done.

remove syntax highlighting

remove syntax highlighting

Developing Sublime Text Plugin

The following steps show you in detail how to develop a plugin in Sublime Text Step 1 Select the New Plugin option by navigating through Tools → Developer → New Plugin as shown below Step 2 The basic code of a plugin includes import of two main libraries: sublime and sublime_plugin. The code for the plugin is import sublime import sublime_plugin class ExampleCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.insert(edit, 0, "Hello, World!") Step 3 The customized plugins are saved in Packages → User folder. Refer to the following screenshot that gives you the complete understanding of the plugins saved in Sublime Text editor.

Running the plugin

When you have created a plugin and saved it, open the console using the shortcut key Ctrl+` on Windows and Cmd+` on OSX, and execute the command shown here view.run_command(plugin-name) This command will execute the plugin defined by the user with the list of activities included in it.

Writing a simple Sublime Text plugin

One of the neat Sublime Text features is that it provides you with a list of commands which you can extend (or write your own) and assign them to different key binds. In this blog post I will go over configuring key binds and use insert_snippet command to generate some debug statements and then we will write few lines of python to extend insert_snippet to use text from clipboard as well. Lets start with key mapping. If you go to Sublime Text preferences you will find a two item grouping for key binds (User and Default). Your new key binds should always go into User. Default should never be modified. If you wish to change any of the default key binds you can override them in the user config instead. Sublime Text will always load default config first, followed by OS specific config and user config last (each overriding previous definitions if needed). Ok, lets add couple of simple key binds to our config file: // Default.sublime-keymap [ { "keys": ["ctrl+shift+h"], "command": "insert_snippet", "args": { "contents": "console.log('=== HEARTBEAT $TM_FILENAME [$TM_LINE_NUMBER] ===');${0}" }, "context": [{ "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true }] }, { "keys": ["ctrl+shift+d"], "command": "insert_snippet", "args": { "contents": "console.log('=== $SELECTION $TM_FILENAME [$TM_LINE_NUMBER] ===', $SELECTION);${0}" }, "context": [{ "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true }] } ] The config is simple array of JSON objects, each containing a set of rules for particular key bind. I have configured two key binds: ctrl+shift+h and ctrl+shift+d. Both use insert_snippet command and are defined within the context of "source.js" (I will explain in a bit). We are passing "console.log(...)" as an argument to insert_snippet in both cases. This is the string that will be inserted at the cursor position once we use ctrl+shift+h or ctrl+shift+d. $TM_LINE_NUMBER, $TM_FILENAME and $SELECTION are environment variables which will be dynamically replaced by Sublime Text at insert time. The following snippet - ${0} will set the caret at this position once our console.log is generated. The context allows you to write language specific key binds. In my case these will work with javascript files. You can have the same key bind with different implementations specific to the programming language you are working in. We can duplicate these two blocks and replace source.js with source.php to make it work with php and change console.log to print_r or dpm (or a different debug function) and Sublime Text will pick the correct snippet to insert depending on the language we are working in. This is a sample output of the two key binds we defined above: // ctrl+shift+h // 477 is a line number // some_file.js is the current js file we are working in. console.log('=== HEARTBEAT some_file.js [477] ==='); // ctrl+shift+d // 478 is a line number // testvar was string we had selected when we pressed our key combination // some_file.js is the current js file we are working in. console.log('=== testvar some_file.js [478] ===', testvar); So we have two key binds, one inserting a general debug heartbeat and the other one printing contents of a selected variable. That's ok so far, but I really wanted to be able to use ctrl+shift+d to create a var dump statement of a variable (string) that is in the clipboard as a fallback or use selected text as it behaves currently. Unfortunately insert_snippet doesn't have access to the clipboard content and we don't have environment variable that contains clipboard content either. There is a paste method in Sublime Text, but unfortunately we are unable to wrap arbitrary string around the clipboard content and can only paste clipboard content alone. We have exhausted all the available resources and will have to write few lines of python and create our own plugin/command that will extend the functionality of insert_snippet and allow it to use the contents from clipboard if needed. Lets write our first Sublime Text plugin that will handle the functionality we outlined above. We start by going to Tools > New Plugin... which will generate a template for our new plugin. The code stub will look something like this: import sublime, sublime_plugin class ExampleCommand(sublime_plugin.TextCommand): def run(self, edit): self.view.insert(edit, 0, "Hello, World!") I rewrote this template and my plugin looks something like this: # insert_snippet_and_clipboard.py import sublime, sublime_plugin class InsertSnippetAndClipboardCommand(sublime_plugin.TextCommand): def run(self, edit, **args): for region in self.view.sel(): if not region.empty(): replacement = self.view.substr(region) args['contents'] = args['contents'].replace('$SELECTION_OR_CLIPBOARD', replacement) self.view.run_command('insert_snippet', args) else: replacement = sublime.get_clipboard().strip() args['contents'] = args['contents'].replace('$SELECTION_OR_CLIPBOARD', replacement) self.view.run_command('insert_snippet', args) You can now save the file as insert_snippet_and_clipboard.py within packages/user/. You can open a Sublime Text console using Ctrl+` and debug your new plugin during development by calling your command using view.run_command("example"). You can pass optional arguments to your command by passing them to run_command like this: view.run_command("example", args). By following Sublime Text convention and naming our class SomeFunctionNameCommand(sublime_plugin.TextCommand): we are creating a text command named some_function_name. In our example we are creating insert_snippet_and_clipboard command which will provide user with $SELECTION_OR_CLIPBOARD environment variable. This environment variable will be populated at insert time. In this implementation we are prioritizing selected text, if no text is selected we are using the last clipboard snipped, and as a fallback we will replace the variable with an empty string. And finally, lets update our key bind ctrl+shift+d to use insert_snippet_and_clipboard command: // Default.sublime-keymap [ { "keys": ["ctrl+shift+h"], "command": "insert_snippet", "args": { "contents": "console.log('=== HEARTBEAT $TM_FILENAME [$TM_LINE_NUMBER] ===');${0}" }, "context": [{ "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true }] }, { "keys": ["ctrl+shift+d"], "command": "insert_snippet_and_clipboard", "args": { "contents": "console.log('=== $SELECTION_OR_CLIPBOARD $TM_FILENAME [$TM_LINE_NUMBER] ===', $SELECTION_OR_CLIPBOARD);${0}" }, "context": [{ "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true }] } ] And that is it. We should be able to generate some var debug statements right away by either selecting a piece of text (or copying it) and hitting ctrl+shift+d.

filter code

<br.*?>|<p.*?>|<span.*?>|<div.*?>|<strong.*?>|<ul.*?>|<li.*?>|<section.*?>|<code.*?>|</strong>|</span>|</div>|</section>|</code>|</ul>|</li>|<svg.*?</svg>|<article.*?>|</article>|<blockquote.*?>|</blockquote>|<mpcpc.*?/mpcpc>|<mpvoice.*/mpvoice>|<hr.*>|<iframe.*?iframe>|<em.*?>|</em>|<noscript>.*?</noscript>|<figure.*?>|</figure> class=".*?"| id=".*?"| style=".*?" class.*?data-src|data.*?data-src|class.*?data-lazy-src class="lazy" data-src data-ratio=".*?" \?wx.*?>   {2,} \n{2,} (^.*\n){3} <p[^>]*>|<div[^>]*>|<strong[^>]*>|<section[^>]*>|</strong>|</div>|</section> \[\d{1,}\] replace https://mmbiz.qpic with https://youwuqiong.top/wp-admin/img.php?imgUrl=https://mmbiz.qpic 歷史故事 歷史故事 品德教育 品德教育 历史人物 詩詞 詩詞 ♦imagelib economics ①②③④⑤⑥⑦⑧⑨ ^.{1,8}?[散汤丸方法饮丹煎]\n ^[\((][一二三四五六七八] ^第[一二三四五六七八九十]{1,}节

search for capital letter

enable case sensitive and use re: ([A-Z])

not include tab in whole line

^[^\t]*$ cut passage into 5 lines blocks (^.*\n){5} to select characters between signatures (?<=com/).*?(?=") Negative Lookahead ( not follow by digit \((?!\d).*?\)

to match lines not containing

<div><a href(?!.*img).*$

find lines that do not contain string pattern

start with <span and no </span> included till end of line <span(?!.*()).*$ <span(?!.*().*$)

Aid in debugging and changing the key bindings

sublime.log_input(True) sublime.log_commands(True) in the Sublime Console and it’ll print out what keys it gets and the commands that it runs. key evt: control+u command: soft_undo Maybe it is by design that when hitting this soft undo with multi selections, that it cancels the whole multi selection. Pity realy, because Esc does the same. { "keys": "ctrl+/", "ctrl+7"], "command": "toggle_comment", "args": { "block": false } }, { "keys": "ctrl+shift+/", "ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }, but it does not work, had to replace them all together with only one key: { "keys": "ctrl+7"], "command": "toggle_comment", "args": { "block": false } }, { "keys": "ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } },

Monaco Editor

Monaco Editor The editor engine behind Visual Studio Code

Automatic Backups for Sublime Text

Backup history navigation Press Ctrl+Alt+[ to navigate backwards one step through a file's backup history. Press Ctrl+Alt+] to navigate forwards one step. Press Ctrl+Shift+Alt+[ to jump to the first copy in the history. Press Ctrl+Shift+Alt+] to jump to the current version (that is, the actual file, not a backup). These commands can also be accessed via Ctrl+Shift+P or Cmd+Shift+P. Merge from backup history When viewing a backup file via backup history navigation, press Ctrl+Alt+Shift+M to merge the backup version you're currently viewing with the latest version of the file using an external merge tool of your choosing. You'll need to specify the command line for this merge tool; for more information go to Preferences->Package Settings->Automatic Backups->Settings - Default. This command can also be accessed via Ctrl+Shift+P or Cmd+Shift+P.

disable autocomplete

In User File settings (Preferences > File Settings - User), add the following: "auto_complete": false This will disable autocomplete as you type, meaning you can still press control+space to bring up autocomplete. Another option is to add a delay to the autocomplete. You can add this line to your user settings: "auto_complete_delay": NUMBER where NUMBER is the number of milliseconds Sublime Text will wait to trigger autocomplete.

turn off the Sublime 3 registration popup

Add this line in your host file. 127.0.0.1 www.sublimetext.com C:\Windows\System32\Drivers\etc\hosts

Sublime Suggestion still coming

added "auto_complete": false and restarted Reason: SublimeCodeIntel installed That plugin does IntelliSense, so it may help to uninstall it or disable it. You can use a config file or set the Base File.sublime-settings “codeintel_live_disabled_languages”: “css”]

count total number of words

Use regular expression to match the words and digits, the number of matches would be displayed on the status line. ctrl+f and \w+ count total words excluding numbers \s+[^0-9] count total words only including numbers \s+[0-9\.]+ select it and remove will get the opposites

python breakpoint plugin

python breakpoint debugger Use ctrl+shift+b to toggle breakpoint in a line But its not preferable solution for debugging a software using a text editor. There are best IDE which makes your development lot easier visual studio community edition Pycharm, Eclipse, Komodo

Sublime Commands

Commands are the basic method for interacting with Sublime Text. Key bindings, menu items, toolbar buttons and macros all work through the command system. If you are editing one of those files, this reference will come in handy. Each command may take one or more parameters, which may be enclosed in quotes. For example, the command to insert the string Hello World!, followed by a newline, is:
insertCharacters "Hello World!\n"

Selection

move move mode amount [extend]
modeOne of characters, words, wordends, wordboundaries, lines, wholelines or pages
amountThe number of mode elements to move the cursor by
extendIf this has the literal value "extend", the selection will be extended in the direction of movement
Moves each cursor, by the given mode, amount number of times. moveTo moveTo position
positionOne of bol, hardbol, eol, hardeol, bof, eof
extendIf this has the literal value "extend", the selection will be extended in the direction of movement
Moves each cursor directly to the indicated position expandSelectionTo expandSelectionTo feature
featureOne of line, word, scope, brackets
expandSelectionToParagraphExpands each selection region to the enclosing paragraph selectAllSelects the entire buffer invertSelectionSelects the non-selected portion of the buffer, and unselects the currently selected portion singleSelectionRemove all selection regions bar the first splitSelectionReplace each non-empty selection region with two empty regions, one for each end splitSelectionIntoLinesSplit each selection region into subsets, one for each line

Editing

insertCharactersInsert the characters given in the first parameter
insertAndDecodeCharactersInsert the characters given in the first parameter, and apply automatic indentation
leftDeleteCharactersErase the contents of each non-empty region, and the character to the left of every empty region. If spaces are being used for indentation, this will erase space characters until the next tab stop
leftDeleteCharactersSingleErase the contents of each non-empty region, and the character to the left of every empty region. This has no special behavior when translateTabsToSpaces is on
rightDeleteCharactersErase the contents of each non-empty region, and the character to the right of every empty region
deleteWord deleteWord direction
directionleft or right
Deletes a word to the left or right of each cursor
copyCopies the current selection to the clipboard
cutCuts the current selection to the clipboard
pasteReplaces the current selection with the contents of the clipboard
undoUndoes the last action
redoRedoes the last action
repeatRepeats the last action
redoOrRepeatRedoes the last action if the redo stack isn't empty, otherwise repeats the last action
joinJoins the following line to the current line, replacing all in between whitespace with a single space
indentIndents the lines currently intersecting the selection
unindentUnindents the lines currently intersecting the selection
scroll scroll amount
amountThe number of lines to scroll
Scroll the view by the given number of lines
displayNameShow the syntax name of the text under the cursor in the status bar
autoCompleteComplete the current word based on other words in the buffer
toggleCommentAdds or removes comments around each selection region. If "block" is supplied as a parameter, block comments will be preferred
swapCaseInverts the case of each selected character
upperCaseMakes each selected character upper case
lowerCaseMakes each selected character lower case
wrapLines wrapLines [column]
columnThe column to wrap the paragraph at
Reformat the current paragraph, ensuring that no line is wider than the column width. If no width is given, it's inferred from the current ruler, or defaults to 70 characters if there is no ruler
sortLines sortLines [caseSensitive] [reverse] [removeDuplicates]
caseSensitiveIf present, the comparison will regard upper case characters as coming before lower case ones
reverseIf present, the order will be reversed
removeDuplicatesIf present, duplicated strings will be eliminated
Sorts all lines intersecting a selection region
sortSelection sortSelection [caseSensitive] [reverse] [removeDuplicates]
caseSensitiveIf present, the comparison will regard upper case characters as coming before lower case ones
reverseIf present, the order will be reversed
removeDuplicatesIf present, duplicated strings will be eliminated
Sorts contents of each selection region with respect to each other
permuteLines permuteLines method
methodThe permutation used, one of reverse, shuffle or unique
Rearranges all lines intersecting a selection region using the given method
permuteSelection permuteSelection method
methodThe permutation used, one of reverse, shuffle or unique
Rearranged the contents of each selection region with respect to each other, using the given method
swapLines swapLines direction
directionup or down
Moves the selected line(s) in the given direction </td>

Find

findNextFinds the next occurrence of the text in the find buffer
findPrevFinds the previous occurrence of the text in the find buffer
findUnderPlaces the current selection (or word if the selection is empty) in the find buffer, and finds the next occurrence
findUnderPrevPlaces the current selection (or word if the selection is empty) in the find buffer, and finds the previous occurrence
findAllUnderPlaces the current selection (or word if the selection is empty) in the find buffer, and finds all occurrences
incrementalFindOpen the incremental find panel, and set the find direction to forward
reverseIncrementalFindOpen the incremental find panel, and set the find direction to reverse

Bookmarks

toggleBookmarkAdds / Removes the current selection to the set of bookmarks
nextBookmarkSelect the next bookmark
prevBookmarkSelect the previous bookmark
allBookmarksSelects all bookmarks
clearBookmarksRemove all bookmarks
gotoBookmark gotoBookmark n
nWhich bookmark to select
Selects the nth bookmark from the top of the buffer

Spelling

nextMisspelledWordSelects the next misspelled word
prevMisspelledWordSelects the previous misspelled word

Macros

startRecordStarts recording a macro
stopRecordStops recording the current macro
toggleRecordStarts / Stops recording the current macro
runMacroRuns the last recorded macro
saveMacroSaves the last recorded macro to disk, prompting the user for a file name
runMacroFile runMacroFile filename
filenameThe macro file
Runs the commands in the given file, showing status information
runMacroFileSilently runMacroFileSilently filename
filenameThe macro file
Runs the commands in the given file, not showing any status information

View and Window Management

newCreates a new buffer
openOpens the file(s) given as parameters, or prompts the user for a file name if none are given
openInCurrentTabOpens the file(s) given as parameters, or prompts the user for a file name if none are given. The view in the current tab is first closed, and replaced with the newly opened vie
openWithEncoding openWithEncoding encoding [filename]
encodingOne of Undefined, Windows-1252, UTF-16 BE, UTF-16 LE, UTF-8
Opens the given file with the encoding, prompting the user for a file name if none is given
switchFile switchFile extensions
extensionsA space separated list of extensions to search through
Opens a file with the same base name, but different extension that the current file. Used to toggle between .h and .c files, for example. </td>
cloneCreates a new view into the current buffer
closeCloses the current view
closeAllCloses all views
saveSaves the current buffer, prompting for a file name if it doesn't have one yet
saveAllSaves all buffers, prompting for a file name for any that don't yet have one
saveAs saveAs [encoding]
encodingOne of Undefined, Windows-1252, UTF-16 BE, UTF-16 LE, UTF-8
Save the current buffer, prompting for a new name
nextViewSelects the next tab
prevViewSelects the previous tab
copyPathCopies the file name of the current buffer to the clipboard
newWindowOpens a new window
closeWindowCloses the current window
exitCloses all windows
toggleFullScreenToggle the current window between full screen and windowed mode
moveToGroup moveToGroup group
group0 based group index
Moves the current view to the given group
focusGroup focusGroup group
group0 based group index
Activates the given group
focusView focusView view
view0 based view index within the current group
Activates the given view within the active group
layoutSingleSets the layout to a single group
layoutDoubleHorizSets the layout to two groups, one above the other
layoutDoubleVertSets the layout to two groups, side by side
layoutTripleSets the layout to three groups
layoutTripleVertSets the layout to three groups, side by side
layoutQuadSets the layout to four groups, in a grid
layoutQuadVertSets the layout to four groups, side by side

Projects

newProjectCreates a new project
openProjectOpen the project given as a parameter, or displays an open dialog if none are given
closeProjectCloses the current project
editProjectOpens the project as a file for editing. The project will be reloaded after save.
scanProjectReloads the project, to pick up new files that should be included
openFileInProjectShows a quick panel to select a file in the project

Building

buildBuilds using the current build system, which may be set globally or per-project. Build systems are defined by .sublime-build files. The format of these is simply to have two lines, one keyed on 'build' and the other 'lineNumberRegex'. These are then used to form an exec command, detailed below.
terminateCancels any currently executing process in the output panel
nextBuildErrorGoes to the source of the next build error
prevBuildErrorGoes to the source of the previous build error
exec exec lineNumberRegex command
lineNumberRegexThe regex that is used to identify build errors in the output. The first submatch should capture the file name, the second should capture the line number, and the third, if any, should capture the column number
commandThe system command to run
Runs the given system command, from the directory of the currently opened file, sending the output to the output panel. Within the command, the following substitutions are available:
$FileFull file name
$FileDirDirectory portion of the file name
$FileNameNon-directory portion of the file name
$FileExtFile extension
$BaseNameFilename with no directory and no extension
Have a look within a .sublime-build file for an example of usage. </td>

Snippets

insertSnippetInserts the snippet given as a parameter into the buffer
insertInlineSnippetAs above, but the contents of the snippet are given as a parameter to the command, rather than the name of a .sublime-snippet file
newSnippetCreates a new snippet, pre-filled out with the basic structure
nextFieldNavigates to the next field (tabstop) in the snippet
prevFieldNavigates to the previous field in the snippet
clearFieldsExits out of snippet mode

Other

showPanel showPanel panel
panelThe panel to show, one of find, incfind, replace, output, console or goto
Show the given panel
hidePanelHide the currently displayed panel
openInBrowserOpens a web browser displaying the current file
terminateTerminates the process currently running in the output window, if any
browseUrl browseUrl url
urlThe URL to open
Opens the given URL in the system browser
browseDir browseDir path
pathThe path to open
Opens the system file browser at the given path
sendEmail sendEmail email
emailThe email address to send to
Opens the default mail client to compose a message to the given email address </td>
wordCountShows a status message with the number of words in the buffer
rot13Applies a rot13 transformation to the selected text

Not Yet Documented

newPlugin
set
setApp
setUser
toggle
setFileType
setLineEnding
markSelection
prevInSelectionHistory
nextInSelectionHistory
clearSelectionHistory
mergeSelection
conflateSelection
times
sequence

Sublime text Commands

complete list of the core commands

There is a fairly complete list of the core commands in Sublime available via the Unofficial Docs, in particular in the command list section. This however doesn't help you to learn about commands that third party packages and plugins may have added, however. If you're in the situation of knowing some way to invoke a command (key, command palette, menu) and wondering what the command is, Sublime has you covered. If you open the Sublime console with Ctrl+` or View > Show Console, you can enter the following command: sublime.log_commands(True) Now whenever you do anything, Sublime logs the command that it's executing the console, along with any arguments that it might take. For example, if you turn on logging and press each of the arrow keys in turn, the console will display this: command: move {"by": "lines", "forward": false} command: move {"by": "lines", "forward": true} command: move {"by": "characters", "forward": false} command: move {"by": "characters", "forward": true} Using this facility you can figure out what commands various actions take, so that you can use them elsewhere. This is also a handy technique for diagnosing things like keyboard shortcuts that don't seem to do what you think they should do, for example. Run the same command with False instead of True (or restart Sublime) to turn the logging off. If you're really interested in the gritty internal details of every possible command, something like the following is possible. This implements a command labelled list_all_commands which, when you run it, will list all of the available commands of all types into a new scratch buffer. Note that not all implemented commands are necessarily meant for external use; plugins sometimes define helper commands for their own use. This means that although this tells you all of the commands that exist, it doesn't mean that all of them are meant for you to play with. Additionally, although this lists roughly the arguments that the run method on the command class takes (which is what Sublime executes to run the command), some commands may have obscure argument lists. import sublime import sublime_plugin import inspect from sublime_plugin import application_command_classes from sublime_plugin import window_command_classes from sublime_plugin import text_command_classes class ListAllCommandsCommand(sublime_plugin.WindowCommand): def run(self): self.view = self.window.new_file() self.view.set_scratch(True) self.view.set_name("Command List") self.list_category("Application Commands", application_command_classes) self.list_category("Window Commands", window_command_classes) self.list_category("Text Commands", text_command_classes) def append(self, line): self.view.run_command("append", {"characters": line + "\n"}) def list_category(self, title, command_list): self.append(title) self.append(len(title)*"=") for command in command_list: self.append("{cmd} {args}".format( cmd=self.get_name(command), args=str(inspect.signature(command.run)))) self.append("") def get_name(self, cls): clsname = cls.__name__ name = clsname[0].lower() last_upper = False for c in clsname[1:]: if c.isupper() and not last_upper: name += '_' name += c.lower() else: name += c last_upper = c.isupper() if name.endswith("_command"): name = name[0:-8] return name

How to Edit Macros

How to Edit Macros Edit it by hand. Save a new file with the extension .sublime-macro under Packages\User and add commands to it. D:\SublimeText3\Data\Packages\User\ahref tail.sublime-macro This is how a macro file looks like: [ {"command": "move_to", "args": {"to": "hardeol"}}, {"command": "insert", "args": {"characters": "\n"}} ] [ {"args":{"characters": "<a href=\""},"command": "insert"}, {"args":{"extend": false,"to": "hardeol"},"command": "move_to"}, {"args":{"characters": "\">"},"command": "insert"}, {"args": null,"command": "right_delete"}, {"args":{"extend": false,"to": "hardeol"},"command": "move_to"}, {"args":{"characters": "</a>"},"command": "insert"}, {"args":{"by": "characters","forward": true},"command": "move"}, {"args":{"characters": "<br>"},"command": "insert"} ] See for more information on commands This is how a keybindings file looks like: [ { "keys": ["alt+f3"], "command": "find_all_under" }, {"keys": ["ctrl+k", "ctrl+b"], "command": "toggle_side_bar" }, {"keys": ["ctrl+shift+t"], "command": "toggle_tabs" }, {"keys": ["ctrl+k", "ctrl+k"], "command": "toggle_status_bar" }, {"keys": ["ctrl+d"], "command": "run_macro_file", "args": { "file": "Packages/User/deleteImg.sublime-macro" }}, {"keys": ["ctrl+."], "command": "run_macro_file", "args": { "file": "Packages/User/insertline.sublime-macro" }}, {"keys": ["ctrl+alt+."], "command": "toggle_setting","args": {"setting": "line_numbers"}}, {"keys": ["ctrl+alt+w"], "command": "toggle_setting","args": {"setting": "word_wrap"}}, {"keys": ["ctrl+shift+r"], "command": "reopen_last_file" }, {"keys": ["ctrl+shift+c"], "command": "title_case" }, {"keys": ["ctrl+up"], "command": "scroll_lines", "args": {"amount": 1.0 } }, {"keys": ["f8"], "command": "permute_lines", "args": {"operation": "unique"} }, {"keys": ["ctrl+shift+d"], "command": "duplicate_lines" }, {"keys": ["ctrl+shift+m"], "command": "run_macro_file", "args": { "file": "Packages/User/ahref tail.sublime-macro" }}, {"keys": ["ctrl+shift+e"], "command": "run_macro_file", "args": { "file": "Packages/User/EOLmac.sublime-macro" }}, {"keys": ["f12"], "command": "reindent", "args": {"single_line": true}}, {"keys": ["shift+f2"], "command": "select_to_bookmark", "args": {"forward": true}}, ] "command": "move", "args": {"by": "characters", "forward": true}

Overview

This list of commands is a work in progress.

About Paths in Command Arguments

Some commands take paths as parameters. Among these, some support snippet-like syntax, while others don’t. A command of the first kind would take a parameter like $packages/SomeDir/SomeFile.ext whereas a command of the second kind would take a parameter like Packages/SomeDir/SomeFile.ext. Generally, newer commands support the snippet-like syntax. Commands expect UNIX-style paths if not otherwise noted, including on Windows (for example, /c/Program Files/Sublime Text 2/sublime_plugin.py). Often, relative paths in arguments to commands are assumed to start at the Data directory.

Variables in Paths as Arguments

The same variables available to build systems are expanded in arguments to commands. See Build System Variables for more information.

Commands

Note This list is incomplete.
build
Runs a build system. variant [String]: Optional. The name of the variant to be run.
set_build_system
Changes the current build system. file [String]: Path to the build system. If empty, Sublime Text tries to automatically find an appropriate build systems from specified selectors. index [Int]: Used in the Tools | Build System menu but otherwise probably not useful.
new_build_system
Creates a new buffer and inserts a build system template.
toggle_save_all_on_build
Toggles whether all open files should be saved before starting the build.
run_macro_file
Runs a .sublime-macro file. file [String]: Relative path to the macro file.
insert_snippet
Inserts a snippet from a string or .sublime-snippet file. contents [String]: Snippet as a string to be inserted. Remember that backslashes \ have to be escaped, like in every other JSON string. name [String]: Relative path to the .sublime-snippet file to be inserted.
See also
Snippets
Documentation on snippets and their variable features.
insert
Inserts a string. characters [String]: String to be inserted.
append
Inserts a string at the end of the view. XXX characters [String]: String to be inserted. force [Bool]: scroll_to_end [Bool]:
move
Advances the caret by predefined units. by [Enum]: Values: characters, words, word_ends, subwords, subword_ends, lines, pages, stops. forward [Bool]: Whether to advance or reverse in the buffer. word_begin [Bool] empty_line [Bool] punct_begin [Bool] separators [Bool] extend [Bool]: Whether to extend the selection. Defaults to false.
move_to
Advances the caret to predefined locations. to [Enum]: Values: bol, eol, bof, eof, brackets. extend [Bool]: Whether to extend the selection. Defaults to false.
open_file
Opens the specified file. Will dynamically open resource files from sublime-package archives as read-only if the specified override file does not exist. file [String]: Absolute or relative path to the file to be opened. Relative paths will originate from the recently Expands snippet-like variables, such as $platform and $packages. contents [String]: This string will be written to the new buffer if the file does not exist. accessed directory (e.g. the directory of the currently opened file).
open_dir
Opens the specified directory with the default file manager. dir [String]: The directory to open.
edit_settings
Opens the default and user settings files in a new window. base_file [String]: The path to the default setting file. default [String]: Content of the user file if none exists. New in version 3124.
open_file_settings
Opens the syntax-specific user settings file for the current syntax.
new_window
Opens a new window.
close_window
Closes the active window.
switch_file
Switches between two files with the same name and different extensions. extensions [String]: Extensions (without leading dot) for which switching will be enabled.
close
Closes the active view.
close_file
Closes the active view and, under certain circumsances, the whole application. XXX Sounds kinda wrong.
exit
Exits the whole application with all open windows.
reopen_last_file
Reopens the last closed file.
save
Saves the active file. encoding [String]: The file encoding to save as.
save_all
Saves all open files.
prompt_save_as
Prompts for a new file name and saves the active file.
save_project_as
Prompts for a new file name and saves the current project.
prompt_select_project
Opens a popup with recently accessed projects where you can fuzzy-search.
prompt_open_project
Prompts for a project file to open as a project.
close_project
Closes the current project.
prompt_add_folder
Prompts for a folder to add to the current project.
close_folder_list
Removes all folders from the current project.
refresh_folder_list
Reloads all folders in the current project and updates the side bar.
toggle_side_bar
Shows or hides the sidebar.
reveal_in_side_bar
Shows the selected file in the sidebar.
toggle_show_open_files
Shows ot hides the open files in the sidebar.
toggle_status_bar
Shows or hides the status bar.
toggle_full_screen
Toggles full screen mode on or off.
toggle_distraction_free
Toggles distraction free mode on or off.
toggle_tabs
Shows or hides the tab bar.
toggle_minimap
Shows or hides the minimap.
left_delete
Deletes the character right before the caret.
right_delete
Deletes the character right after the caret.
undo
Undoes the latest action.
redo
Reapplies the latest undone action.
redo_or_repeat
Performs the latest action again.
soft_undo
Undoes each action stepping through granular edits.
soft_redo
Redoes each action stepping through granular edits.
cut
Removes the selected text and sends it to the system clipboard. Put differently, it cuts.
copy
Sends the selected text to to the system clipboard.
paste
Inserts the clipboard contents after the caret. clipboard [String]: May be selection. XXX what other values are allowed?
paste_and_indent
Inserts the clipboard contents after the caret and indents contextually.
select_lines
Adds a line to the current selection. forward [Bool]: Whether to add the next or previous line. Defaults to true.
scroll_lines
Scrolls lines in the view. amount [Float]: Positive values scroll lines down and negative values scroll lines up.
prev_view
Switches to the previous view.
next_view
Switches to the next view.
next_view_in_stack
Switches to the most recently active view.
prev_view_in_stack
Switches to the view that was active before the most recently active view.
select_all
Select the view’s content.
split_selection_into_lines
Splits the selection into multiple selections, one on each line.
single_selection
Collapses multiple selections into a single selection.
clear_fields
Breaks out of the active snippet field cycle.
hide_panel
Hides the active panel. cancel [Bool]: Notifies the panel to restore the selection to what it was when the panel was opened. (Only incremental find panel.)
hide_overlay
Hides the active overlay. Show the overlay using the show_overlay command.
hide_auto_complete
Hides the auto complete list.
insert_best_completion
Inserts the best completion that can be inferred from the current context. XXX Probably useless. XXX default [String]: String to insert failing a best completion.
replace_completion_with_next_completion
XXX Useless for users. XXX
reindent
Corrects indentation of the selection with regular expressions set in the syntax’s preferences. The base indentation will be that of the line before the first selected line. Sometimes does not work as expected.
indent
Increments indentation of selection.
unindent
Unindents selection.
detect_indentation
Guesses the indentation from the current file.
next_field
Advances the caret to the text snippet field in the current snippet field cycle.
prev_field
Moves the caret to the previous snippet field in the current snippet field cycle.
commit_completion
Inserts into the buffer the item that’s currently selected in the auto complete list. XXX Probably not useful for users. XXX
toggle_overwrite
Toggles overwriting on or off.
expand_selection
Extends the selection up to predefined limits. to [Enum]: Values: bol, hardbol, eol, hardeol, bof, eof, brackets, line, tag, scope, indentation.
close_tag
Surrounds the current inner text with the appropiate tags.
toggle_record_macro
Starts or stops the macro recorder.
run_macro
Runs the macro stored in the macro buffer.
save_macro
Prompts for a file path to save the macro in the macro buffer to.
show_overlay
Shows the requested overlay. Use the hide_overlay command to hide it.
overlay [Enum]:
The type of overlay to show. Possible values:goto: Show the Goto Anything overlay. command_palette: Show the Command Palette.
show_files [Bool]: If using the goto overlay, start by displaying files rather than an empty widget. text [String]: The initial contents to put in the overlay.
show_panel
Shows a panel. panel [Enum]: Values: incremental_find, find, replace, find_in_files, console or output.<panel_name>. reverse [Bool]: Whether to search backwards in the buffer. toggle [Bool]: Whether to hide the panel if it’s already visible.
find_next
Finds the next occurrence of the current search term.
find_prev
Finds the previous occurrence of the current search term.
find_under_expand
Adds a new selection based on the current selection or expands the selection to the current word.
find_under_expand_skip
Adds a new selection based on the current selection or expands the selection to the current word while removing the current selection.
find_under
Finds the next occurrence of the current selection or the current word.
find_under_prev
Finds the previous occurrence of the current selection or the current word.
find_all_under
Finds all occurrences of the current selection or the current word.
slurp_find_string
Copies the current selection or word into the “find” field of the find panel.
slurp_replace_string
Copies the current selection or word into the “replace” field of the find and replace panel.
next_result
Advance to the next captured result.
prev_result
Move to the previous captured result.
toggle_setting
Toggles the value of a boolean setting. This value is view-specific. setting [String]: The name of the setting to be toggled.
set_setting
Set the value of a setting. This value is view-specific. setting [String]: The name of the setting to changed. value [*]: The value to set to.
set_line_ending
Changes the line endings of the current file. type [Enum]: windows, unix, cr
next_misspelling
Advance to the next misspelling
prev_misspelling
Move to the previous misspelling.
swap_line_down
Swaps the current line with the line below.
swap_line_up
Swaps the current line with the line above.
toggle_comment
Comments or uncomments the active lines, if available. block [Bool]: Whether to insert a block comment.
join_lines
Joins the current line with the next one.
duplicate_line
Duplicates the current line.
auto_complete
Opens the auto complete list.
replace_completion_with_auto_complete
XXX Useless for users. XXX
show_scope_name
Shows the name for the caret’s scope in the status bar.
exec
Runs an external process asynchronously. On Windows, GUIs are supressed. exec is the default command used by build systems, thus it provides similar functionality. However, a few options in build systems are taken care of by Sublime Text internally so they list below only contains parameters accepted by this command. cmd [[String]] shell_cmd [String]: Shell command to use. If given overrides cmd and ignores shell. file_regex [String] line_regex [String] working_dir [String] encoding [String] env [{String: String}] quiet [Bool]: If True no runtime information is printed if the command fails or has a non-zero exit code. kill [Bool]: If True will simply terminate the current build process. This is invoked via Build: Cancel command from the Command Palette. update_phantoms_only [Bool] hide_phantoms_only [Bool] word_wrap [Bool]: Whether to word-wrap the output in the build panel syntax [String]: Syntax file used to colour output. path [String] shell [Bool] See also
Arbitrary Options for build systems
Detailed documentation on all other available options.
transpose
Makes selections or characters swap places. With selection: The contents of the selected regions are circulated. Without selection: Swaps adjacent characters and moves the caret forward by 1.
sort_lines
Sorts lines. case_sensitive [Bool]: Whether the sort should be case sensitive.
sort_selection
Sorts lines in selection. case_sensitive [Bool]: Whether the sort should be case sensitive.
permute_lines
XXX operation [Enum]: reverse, unique, shuffle …?
permute_selection
XXX operation [Enum]: reverse, unique, shuffle …?
set_layout
Changes the group layout of the current window. This command uses the same pattern as Window.set_layout(), see there for a list and explanation of parameters.
focus_group
Gives focus to the top-most file in the specified group. group [Int]: The group index to focus. This is determined by the order of cells items from the current layout (see Window.set_layout()).
move_to_group
Moves the current file to the specified group. group [Int]: The group index to focus. See focus_group command.
select_by_index
Focuses a certain tab in the current group. index [Int]: The tab index to focus.
next_bookmark
Select the next bookmarked region.
prev_bookmark
Select the previous bookmarked region.
toggle_bookmark
Sets or unsets a bookmark for the active region(s). (Bookmarks can be accessed via the regions API using "bookmarks" as the key.)
select_bookmark
Selects a bookmarked region in the current file. index [Int]
clear_bookmarks
Removes all bookmarks.
select_all_bookmarks
Selects all bookmarked regions.
wrap_lines
Wraps lines. By default, it wraps lines at the first ruler’s column. width [Int]: Specifies the column at which lines should be wrapped.
upper_case
Makes the selection upper case.
lower_case
Makes the selection lower case.
title_case
Capitalizes the selection’s first character and turns the rest into lower case.
swap_case
Swaps the case of each character in the selection.
set_mark
Marks the position of each caret in the current file. If any marks have already been set in that file, they are removed.
select_to_mark
Selects the text between the current position of each one of the current carets and the marked position. Each caret is matched with each mark in order of occurrence, and is moved to the beginning of its selection. If any number of selections overlap, they are joined and, of all the carets corresponding to each one of the joined selections, only the one occurring first in the file is preserved. If the number of current carets is less or equal to the number of marks, the remaining marks in order are ignored. Conversely, if currently there are more carets than marks, the first relevant selections are produced. Of all extra marks, those contained in the selections are removed, and the rest of them are left where they are, without triggering a selection from their position.
delete_to_mark
Deletes the text that select_to_mark would select.
swap_with_mark
Marks all the current carets’ positions, removes those carets, and sets new carets at the previously marked positions, if any.
clear_bookmarks
If no name argument, or the name “bookmarks” is specified, it removes all bookmarks set in the current file, but not the marks. If the name “mark” is specified as an argument, it removes all marks set in the current file, but not the bookmarks. name [String]: e.g. "mark", "bookmarks".
yank
XXX
show_at_center
Scrolls the view to show the selected line in the middle of the view and adjusts the horizontal scrolling if necessary.
increase_font_size
Increases the font size.
decrease_font_size
Decreases the font size.
reset_font_size
Resets the font size to the default Note: This essentially removes the entry from your User settings, there might be other places where this has been “changed”.
fold
Folds the current selection and displays instead. Unfold arrows are added to the lines where a region has been folded.
unfold
Unfolds all folded regions in the selection or the current line if there is none.
fold_by_level
Scans the whole file and folds everything with an indentation level of level or higher. This does not unfold already folded regions if you first fold by level 2 and then by 3, for example. Sections with cursors are not folded. level [Int]: The level of indentation that should be folded. 0 is equivalent to running unfold_all.
fold_tag_attributes
Folds all tag attributes in XML files, only leaving the tag’s name and the closing bracket visible.
unfold_all
Unfolds all folded regions.
context_menu
Shows the context menu.
open_recent_file
Opens a recently closed file. index [Int]
open_recent_folder
Opens a recently closed folder. index [Int]
open_recent_project
Opens a recently closed project. index [Int]
clear_recent_files
Deletes records of recently accessed files and folders.
clear_recent_projects
Deletes records of recently accessed projects.
reopen
Reopens the current file. encoding [String]: The file encoding the file should be reopened with.
clone_file
Clones the current view into the same tab group, both sharing the same buffer. That means you can drag one tab to another group and every update to one view will be visible in the other one too.
revert
Undoes all unsaved changes to the file.
expand_tabs
XXX set_translate_tabs [Bool]
unexpand_tabs
XXX set_translate_tabs [Bool]
new_plugin
Creates a new buffer and inserts a plugin template (a text command).
new_snippet
Creates a new buffer and inserts a snippet template.
open_url
Opens the specified url with the default browser. url [String]
show_about_window
I think you know what this does.

Discovering Commands

There are several ways to discover a command’s name in order to use it as a key binding, in a macro, as a menu entry or in a plugin. Browsing the default key bindings at Preferences | Key Bindings - Default. If you know the key binding whose command you want to inspect you can just search for it using the search panel. This, of course, also works in the opposite direction. ``sublime.log_commands(True)`` Running the above in the console will tell Sublime Text to print the command’s name in the console whenever a command is run. You can practically just enter this, do whatever is needed to run the command you want to inspect and then look at the console. It will also print the passed arguments so you can basically get all the information you need from it. When you are done, just run the function again with False as parameter. Inspecting .sublime-menu files. If your command is run by a menu item, browse the default menu file at Packages/Default/Main.sublime-menu. You will find them quick enough once you take a look at it, or see the menu documentation. Similar to menus you can do exactly the same with .sublime-command files. See Completions for some documentation on completion files.

count word number in sublime text

press ctrl+f to find \w+

get the full list of installed packages

Preferences -> Package Settings -> Package Control -> Settings-User.